<template id="Coupon">
    <div>
        <div class="Coupon_shop_detail">
            <img src="../image/blue_da.png" alt="" @click="getDetails()">
            <h4>优惠券</h4>
        </div>
        <div class="Coupon_details_model">
            <div class="Coupon_detail_s" >
                <div class="Coupon_detail_bac"  v-for="(item, index) in items">
                    <span>{{item.face_value | formatMoney}}</span>
                    
					<span v-if=" item.min_goods_amount <= 10.00">无门槛</span>
					<span v-else>订单满{{item.face_value | formatMoney }}元使用</span>
					
					
                    <span>元优惠券</span>
                    <span v-if="item.send_type == 4">
						{{item.expire_time }} 过期
					</span>
					
                    <span v-if="item.send_type != 4">
						{{item.use_start_date  }} 至 {{item.use_end_date }}
					</span>
                    <span>立即使用</span>
                </div>

            </div>


        </div>
    </div>
</template>
<script>
export default {
        name:'Coupon',
        data(){
            return{
				mode:'get_user_coupon',
				items:[],
            }
        },
		filters: {
			formatMoney(money) {
				return parseInt(money);
			}
		},
        mounted:function(){
			//初始化
			this.getItems(this.mode);
			
        },
        methods:{
			formatDateTime(time) {
				var date = new Date(parseInt(time) * 1000);
				return this.GLOBAL.formatDate(date, 'yyyy-MM-dd hh:mm');
			},
			getItems:function(mode){

                let url  = this.GLOBAL.BaseUrl+'/mobile/api/v1/Public.php?mode='+mode;
                let Data = this.GLOBAL.dataParam();

                this.$ajax.post(url, Data).then((res) => {
                    let temp = res.data;
                    if(temp.code == 200){
                        this.items = temp.data;
                    }else{
                        this.GLOBAL.center_error(this,temp);        
                    }                 
                 })

			},
            getDetails:function(){
                window.history.go(-1);
            }
    }}
</script>
<style>
    .Coupon_shop_detail{
        height:0.79rem;
        width:100%;
        border-bottom:1px solid #cfcecd;
        position:relative;
        background:#ffffff;
    }
    .Coupon_shop_detail img{
        height:0.36rem;
        width:0.36rem;
        display:block;
        position:absolute;
        left:0.25rem;
        top:0.25rem;
    }
    .Coupon_shop_detail h4{
        height:0.79rem;
        color:#85a45a;
        font-size:0.24rem;
        line-height:0.79rem;
        text-align:center;
        font-weight:normal;
    }
    .Coupon_detail_bac span:nth-of-type(1){
        position:absolute;
        width:0.69rem;
        height:0.46rem;
        color:#ffffff;
        font-size:0.46rem;
        left:0.45rem;
        top:0.13rem;
        line-height:0.4rem;
        display:block;
    }
    .Coupon_detail_bac span:nth-of-type(2){
        width: 1.5rem;
        height:0.23rem;
        line-height:0.23rem;
        color:#fdf6f9;
        display:block;
        font-size:0.14rem;
        position:absolute;
        left:1.4rem;
        top:0.1rem;
    }
    .Coupon_detail_bac span:nth-of-type(3){
        position:absolute;
        display:block;
        width:1.2rem;
        height:0.23rem;
        font-size:0.18rem;
        color:#ffffff;
        font-weight:700;
        left:1.4rem;
        top:0.33rem;
    }
    .Coupon_detail_bac span:nth-of-type(4){
        position:absolute;
        display:block;
      /*  width:2.45rem;*/
        height:0.32rem;
        line-height:0.32rem;
        text-align:center;
        color:#ffffff;
        font-size:0.14rem;
        top:0.57rem;
		 left: 30px;
    }
    .Coupon_detail_bac span:nth-of-type(5){
        position:absolute;
        display:block;
        width:1.38rem;
        height:0.9rem;
        color:#e688b2;
        font-size:0.2rem;
        line-height:0.9rem;
        text-align:center;
        left:4.04rem;
    }
    .Coupon_detail_bac{
        width:5.50rem;
        height:0.9rem;
        background:url(../image/bac.png) no-repeat ;
        background-size:cover;
        position:relative;
		margin-bottom: 20px;

    }
    .Coupon_detail_s{
        width:100%;
        height:auto;
        background:#eeeeee;
        padding:0.5rem 0.5rem 0.36rem 0.36rem;
    }
    .Coupon_details_model p:nth-of-type(1){
        height:0.8rem;
        width:100%;
        line-height:0.8rem;
        text-align:center;
        color:#494949;
        font-size:0.28rem;
        border-bottom:1px solid #d9d9d9;
        background:#ffffff;
        position:relative;
    }
    .Coupon_details_model p:nth-of-type(1) img{
        position:absolute;
        top: 0.2rem;
        left:0.2rem;
        height:0.43rem;
        width:0.51rem;

    }
    .Coupon_details_model p:nth-of-type(1){
        height:0.8rem;
        width:100%;
        line-height:0.8rem;
        text-align:center;
        color:#494949;
        font-size:0.28rem;
        border-bottom:1px solid #d9d9d9;
        background:#ffffff;
        position:relative;
    }
    . Coupon_details_model p:nth-of-type(1) img{
        position:absolute;
        top: 0.2rem;
        left:0.2rem;
        height:0.43rem;
        width:0.51rem;

    }
    . Coupon_details_model{
        height:5.13rem;
        width:100%;
        position:fixed;
        bottom:0;
        left:0;
    }
</style>